#pragma once
#ifndef __G_INITIALIZABLE_H__
#define __G_INITIALIZABLE_H__

#include <atomic>

namespace GUtil
{
	enum GInitState
	{
		G_IS_INITIALIZED	= 0,
		G_IS_UNINITIALIZED	= 1,
		G_IS_INITIALIZING	= 2,
		G_IS_UNINITIALIZING	= 3
	};

	class GInitializable
	{
	typedef std::atomic<GInitState> StateType;
	
	private:
		StateType		InitState;

	protected:
						GInitializable();
		virtual			~GInitializable();

	public:
		GInitState		GetInitializationState() const;

		virtual bool	Initialize();
		virtual bool	InitializeLate();
		
		virtual void	Uninitialize();
		virtual void	UninitializeEarly();

	};

}

#endif